$(function () {
  $("#btn1").on("click", function () {
    // post方法{
    //   "userName": "HG10028",
    //   "password": "123456"
    // }

    // let url = "http://172.21.82.45:8080/store/user/login";
    // http://172.21.66.242:9020/api/store/user/login
    let url = "/api/store/user/login";

    $.ajax({
      type: "POST",
      url: url,
      contentType: "application/json;charset=UTF-8",
      data: JSON.stringify({
        userName: "HG10028",
        password: "123456",
      }),
      success: function (res) {
        console.log(res);
      },
      // dataType: "jsonp",
      dataType: "json",
    });
  });

  let ticket = null;

  let getTicketUrl = "/api/store/productSolution/getTicket";
  $("#btn2").on("click", function () {
    $.ajax({
      type: "GET",
      url: getTicketUrl,
      contentType: "application/json;charset=UTF-8",
      success: function (res) {
        console.log(res);
        ticket = res.data;
      },
    });
  });

  let nextSystem = "http://172.21.83.89:9002/";
  $("#btn3").on("click", function () {
    window.location.href = `${nextSystem}?token=${ticket}`;
  });
});
